﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace ProductMonitor.OpCommand
{
    public class Command : ICommand
    {

        private Action _action;

        public Command(Action action)
        {
            this._action = action;
        }
        event EventHandler? ICommand.CanExecuteChanged
        {
            add
            {
               
            }

            remove
            {
                
            }
        }

        bool ICommand.CanExecute(object? parameter)
        {
            return true;
        }
        /// <summary>
        /// 执行方法
        /// </summary>
        /// <param name="parameter"></param>
        /// <exception cref="NotImplementedException"></exception>
        void ICommand.Execute(object? parameter)
        {
            if (_action != null)
            {
                _action();
            }
        }
    }
}
